<template>
  <el-container class="login">
    <!-- 主要内容 -->
    <el-row class="main" type="flex" justify="center" align="middle">
      <div class="form-wrapper">
        <!-- 表单头部tab -->
        <el-row type="flex" justify="center" class="tabs">
          <span
            :class="{ active: currentTab === index }"
            v-for="(item, index) in ['登录', '注册']"
            :key="index"
            @click="handleChangeTab(index)"
          >
            {{ item }}
          </span>
        </el-row>
        <LoginForm v-if="currentTab == 0" />

        <!-- 注册功能组件 -->
        <RegisterForm v-if="currentTab == 1"/>
      </div>
    </el-row>
  </el-container>
</template>

<script>
import LoginForm from '@/components/user/login/LoginForm.vue'
import RegisterForm from '@/components/user/login/RegisterForm.vue'
export default {
  name: 'Login',
  components: {
    LoginForm,
    RegisterForm
  },
  data () {
    return {
      currentTab: 0
    }
  },
  methods: {
    handleChangeTab (index) {
      this.currentTab = index
    },
  }
}
</script>

<style lang="scss" scoped>
.login {
  background: url('../../assets/images/tour2.jpg');
  background-repeat: no-repeat;
  background-size: cover;
  height: 700px;
  min-width: 1000px;
  // filter: blur(10px);
}
.main {
  width: 1000px;
  height: 100%;
  margin: 0 auto;
  position: relative;

  .form-wrapper {
    width: 400px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
    overflow: hidden;

    .tabs {
      span {
        display: block;
        width: 50%;
        height: 50px;
        box-sizing: border-box;
        border-top: 2px #eee solid;
        background: #eee;
        line-height: 48px;
        text-align: center;
        cursor: pointer;
        color: #666;

        &.active {
          color: orange;
          border-top-color: orange;
          background: #fff;
          font-weight: bold;
        }
      }
    }
  }
}
</style>
